package com.liuzy.beauty;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * http://www.8mei.cc/
 * 
 * @author liuzy
 * @since 2015年10月26日
 */
public class Mei8 extends Beauty {
	public static void main(String[] args) {
		new Mei8("D:\\beauty\\mei8\\", "http://www.8mei.cc/").start();
	}

	public Mei8(String saveDir, String startUrl) {
		super(saveDir, startUrl);
	}

	@Override
	public void search(String url, String html) {
		Matcher matcher = Pattern.compile("http://www.8mei.cc/.*?.html").matcher(html);
		while (matcher.find()) {
			grilQueue.add(matcher.group());
		}
		matcher = Pattern.compile("http://www.8mei.cc/uploads/.*?.jpg").matcher(html);
		while (matcher.find()) {
			imageQueue.add(matcher.group());
		}
	}

	@Override
	public String reName(String url) {
		return url.substring(url.indexOf("uploads/") + 8).replaceAll("/", ".");
	}

}
